package com.prompt.utils;

import android.content.Context;
import android.os.PowerManager;

public class CommonUtil {

	private static CommonUtil instance;
	//声明电源管理器
	private PowerManager pm;
	private PowerManager.WakeLock wakeLock;
	private Context mContext;
	private boolean isInitLazy = false;
	public void setmContext(Context mContext) {
		this.mContext = mContext;
	}

	public CommonUtil(){
		
	}
	
	private void initLazy(){
		if(isInitLazy){
			return;
		}
		//获取电源的服务
		pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
		isInitLazy = true;
	}
	
	public void lightSc(){
		initLazy();
		wakeLock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP, "lightSc My Tag");
		wakeLock.acquire();
	}
	
	public static CommonUtil getInstance(){
		if(instance == null){
			instance = new CommonUtil();
		}
		return instance;
	}
}
